using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Text;

namespace Data_Access_Tier
{
	public class HRM_TIMEKEEPER_SHIFTData : DatabaseObjectBase
	{
		public HRM_TIMEKEEPER_SHIFTData()
		{
			Initialize(true);
		}
		public HRM_TIMEKEEPER_SHIFTData(Boolean newConnection)
		{
			Initialize(newConnection);
		}

		public Int32 HRM_TIMEKEEPER_SHIFT_Insert(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, Boolean AllDay, Boolean D1, Boolean D2, Boolean D3, Boolean D4, Boolean D5, Boolean D6, Boolean D7, Boolean D8, Boolean D9, Boolean D10, Boolean D11, Boolean D12, Boolean D13, Boolean D14, Boolean D15, Boolean D16, Boolean D17, Boolean D18, Boolean D19, Boolean D20, Boolean D21, Boolean D22, Boolean D23, Boolean D24, Boolean D25, Boolean D26, Boolean D27, Boolean D28, Boolean D29, Boolean D30, Boolean D31)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.InsertCommand = new SqlCommand("HRM_TIMEKEEPER_SHIFT_Insert");
				_dbadapter.InsertCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.InsertCommand.Connection = _dbconn;
				_trans = _dbconn.BeginTransaction();
				_dbadapter.InsertCommand.Transaction = _trans;
				_dbadapter.InsertCommand.Parameters.Clear();
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@AllDay", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D1", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D2", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D3", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D4", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D5", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D6", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D7", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D8", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D9", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D10", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D11", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D12", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D13", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D14", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D15", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D16", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D17", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D18", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D19", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D20", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D21", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D22", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D23", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D24", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D25", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D26", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D27", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D28", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D29", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D30", SqlDbType.Bit));
				_dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@D31", SqlDbType.Bit));
				_dbadapter.InsertCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.InsertCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.InsertCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.InsertCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlBoolean AllDaySQL = AllDay;
				_dbadapter.InsertCommand.Parameters["@AllDay"].Value = AllDaySQL;
				SqlBoolean D1SQL = D1;
				_dbadapter.InsertCommand.Parameters["@D1"].Value = D1SQL;
				SqlBoolean D2SQL = D2;
				_dbadapter.InsertCommand.Parameters["@D2"].Value = D2SQL;
				SqlBoolean D3SQL = D3;
				_dbadapter.InsertCommand.Parameters["@D3"].Value = D3SQL;
				SqlBoolean D4SQL = D4;
				_dbadapter.InsertCommand.Parameters["@D4"].Value = D4SQL;
				SqlBoolean D5SQL = D5;
				_dbadapter.InsertCommand.Parameters["@D5"].Value = D5SQL;
				SqlBoolean D6SQL = D6;
				_dbadapter.InsertCommand.Parameters["@D6"].Value = D6SQL;
				SqlBoolean D7SQL = D7;
				_dbadapter.InsertCommand.Parameters["@D7"].Value = D7SQL;
				SqlBoolean D8SQL = D8;
				_dbadapter.InsertCommand.Parameters["@D8"].Value = D8SQL;
				SqlBoolean D9SQL = D9;
				_dbadapter.InsertCommand.Parameters["@D9"].Value = D9SQL;
				SqlBoolean D10SQL = D10;
				_dbadapter.InsertCommand.Parameters["@D10"].Value = D10SQL;
				SqlBoolean D11SQL = D11;
				_dbadapter.InsertCommand.Parameters["@D11"].Value = D11SQL;
				SqlBoolean D12SQL = D12;
				_dbadapter.InsertCommand.Parameters["@D12"].Value = D12SQL;
				SqlBoolean D13SQL = D13;
				_dbadapter.InsertCommand.Parameters["@D13"].Value = D13SQL;
				SqlBoolean D14SQL = D14;
				_dbadapter.InsertCommand.Parameters["@D14"].Value = D14SQL;
				SqlBoolean D15SQL = D15;
				_dbadapter.InsertCommand.Parameters["@D15"].Value = D15SQL;
				SqlBoolean D16SQL = D16;
				_dbadapter.InsertCommand.Parameters["@D16"].Value = D16SQL;
				SqlBoolean D17SQL = D17;
				_dbadapter.InsertCommand.Parameters["@D17"].Value = D17SQL;
				SqlBoolean D18SQL = D18;
				_dbadapter.InsertCommand.Parameters["@D18"].Value = D18SQL;
				SqlBoolean D19SQL = D19;
				_dbadapter.InsertCommand.Parameters["@D19"].Value = D19SQL;
				SqlBoolean D20SQL = D20;
				_dbadapter.InsertCommand.Parameters["@D20"].Value = D20SQL;
				SqlBoolean D21SQL = D21;
				_dbadapter.InsertCommand.Parameters["@D21"].Value = D21SQL;
				SqlBoolean D22SQL = D22;
				_dbadapter.InsertCommand.Parameters["@D22"].Value = D22SQL;
				SqlBoolean D23SQL = D23;
				_dbadapter.InsertCommand.Parameters["@D23"].Value = D23SQL;
				SqlBoolean D24SQL = D24;
				_dbadapter.InsertCommand.Parameters["@D24"].Value = D24SQL;
				SqlBoolean D25SQL = D25;
				_dbadapter.InsertCommand.Parameters["@D25"].Value = D25SQL;
				SqlBoolean D26SQL = D26;
				_dbadapter.InsertCommand.Parameters["@D26"].Value = D26SQL;
				SqlBoolean D27SQL = D27;
				_dbadapter.InsertCommand.Parameters["@D27"].Value = D27SQL;
				SqlBoolean D28SQL = D28;
				_dbadapter.InsertCommand.Parameters["@D28"].Value = D28SQL;
				SqlBoolean D29SQL = D29;
				_dbadapter.InsertCommand.Parameters["@D29"].Value = D29SQL;
				SqlBoolean D30SQL = D30;
				_dbadapter.InsertCommand.Parameters["@D30"].Value = D30SQL;
				SqlBoolean D31SQL = D31;
				_dbadapter.InsertCommand.Parameters["@D31"].Value = D31SQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.InsertCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_SHIFT_Insert: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_SHIFT_Insert: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.InsertCommand != null)
					_dbadapter.InsertCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_SHIFT_Update(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, Boolean AllDay, Boolean D1, Boolean D2, Boolean D3, Boolean D4, Boolean D5, Boolean D6, Boolean D7, Boolean D8, Boolean D9, Boolean D10, Boolean D11, Boolean D12, Boolean D13, Boolean D14, Boolean D15, Boolean D16, Boolean D17, Boolean D18, Boolean D19, Boolean D20, Boolean D21, Boolean D22, Boolean D23, Boolean D24, Boolean D25, Boolean D26, Boolean D27, Boolean D28, Boolean D29, Boolean D30, Boolean D31)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_TIMEKEEPER_SHIFT_Update");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllDay", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D1", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D2", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D3", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D4", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D5", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D6", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D7", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D8", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D9", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D10", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D11", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D12", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D13", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D14", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D15", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D16", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D17", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D18", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D19", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D20", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D21", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D22", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D23", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D24", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D25", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D26", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D27", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D28", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D29", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D30", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D31", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.UpdateCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.UpdateCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlBoolean AllDaySQL = AllDay;
				_dbadapter.UpdateCommand.Parameters["@AllDay"].Value = AllDaySQL;
				SqlBoolean D1SQL = D1;
				_dbadapter.UpdateCommand.Parameters["@D1"].Value = D1SQL;
				SqlBoolean D2SQL = D2;
				_dbadapter.UpdateCommand.Parameters["@D2"].Value = D2SQL;
				SqlBoolean D3SQL = D3;
				_dbadapter.UpdateCommand.Parameters["@D3"].Value = D3SQL;
				SqlBoolean D4SQL = D4;
				_dbadapter.UpdateCommand.Parameters["@D4"].Value = D4SQL;
				SqlBoolean D5SQL = D5;
				_dbadapter.UpdateCommand.Parameters["@D5"].Value = D5SQL;
				SqlBoolean D6SQL = D6;
				_dbadapter.UpdateCommand.Parameters["@D6"].Value = D6SQL;
				SqlBoolean D7SQL = D7;
				_dbadapter.UpdateCommand.Parameters["@D7"].Value = D7SQL;
				SqlBoolean D8SQL = D8;
				_dbadapter.UpdateCommand.Parameters["@D8"].Value = D8SQL;
				SqlBoolean D9SQL = D9;
				_dbadapter.UpdateCommand.Parameters["@D9"].Value = D9SQL;
				SqlBoolean D10SQL = D10;
				_dbadapter.UpdateCommand.Parameters["@D10"].Value = D10SQL;
				SqlBoolean D11SQL = D11;
				_dbadapter.UpdateCommand.Parameters["@D11"].Value = D11SQL;
				SqlBoolean D12SQL = D12;
				_dbadapter.UpdateCommand.Parameters["@D12"].Value = D12SQL;
				SqlBoolean D13SQL = D13;
				_dbadapter.UpdateCommand.Parameters["@D13"].Value = D13SQL;
				SqlBoolean D14SQL = D14;
				_dbadapter.UpdateCommand.Parameters["@D14"].Value = D14SQL;
				SqlBoolean D15SQL = D15;
				_dbadapter.UpdateCommand.Parameters["@D15"].Value = D15SQL;
				SqlBoolean D16SQL = D16;
				_dbadapter.UpdateCommand.Parameters["@D16"].Value = D16SQL;
				SqlBoolean D17SQL = D17;
				_dbadapter.UpdateCommand.Parameters["@D17"].Value = D17SQL;
				SqlBoolean D18SQL = D18;
				_dbadapter.UpdateCommand.Parameters["@D18"].Value = D18SQL;
				SqlBoolean D19SQL = D19;
				_dbadapter.UpdateCommand.Parameters["@D19"].Value = D19SQL;
				SqlBoolean D20SQL = D20;
				_dbadapter.UpdateCommand.Parameters["@D20"].Value = D20SQL;
				SqlBoolean D21SQL = D21;
				_dbadapter.UpdateCommand.Parameters["@D21"].Value = D21SQL;
				SqlBoolean D22SQL = D22;
				_dbadapter.UpdateCommand.Parameters["@D22"].Value = D22SQL;
				SqlBoolean D23SQL = D23;
				_dbadapter.UpdateCommand.Parameters["@D23"].Value = D23SQL;
				SqlBoolean D24SQL = D24;
				_dbadapter.UpdateCommand.Parameters["@D24"].Value = D24SQL;
				SqlBoolean D25SQL = D25;
				_dbadapter.UpdateCommand.Parameters["@D25"].Value = D25SQL;
				SqlBoolean D26SQL = D26;
				_dbadapter.UpdateCommand.Parameters["@D26"].Value = D26SQL;
				SqlBoolean D27SQL = D27;
				_dbadapter.UpdateCommand.Parameters["@D27"].Value = D27SQL;
				SqlBoolean D28SQL = D28;
				_dbadapter.UpdateCommand.Parameters["@D28"].Value = D28SQL;
				SqlBoolean D29SQL = D29;
				_dbadapter.UpdateCommand.Parameters["@D29"].Value = D29SQL;
				SqlBoolean D30SQL = D30;
				_dbadapter.UpdateCommand.Parameters["@D30"].Value = D30SQL;
				SqlBoolean D31SQL = D31;
				_dbadapter.UpdateCommand.Parameters["@D31"].Value = D31SQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_SHIFT_Update: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_SHIFT_Update: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_SHIFT_Disable(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, ref Boolean Enabled)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_TIMEKEEPER_SHIFT_Disable");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@enabled", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.UpdateCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.UpdateCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				_dbadapter.UpdateCommand.Parameters["@enabled"].Direction = ParameterDirection.Output;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_SHIFT_Disable: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_SHIFT_Disable: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_SHIFT_Delete(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.DeleteCommand = new SqlCommand("HRM_TIMEKEEPER_SHIFT_Delete");
				_dbadapter.DeleteCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.DeleteCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.DeleteCommand.Transaction = _trans;

				_dbadapter.DeleteCommand.Parameters.Clear();
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.DeleteCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.DeleteCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.DeleteCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.DeleteCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.DeleteCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_SHIFT_Delete: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_SHIFT_Delete: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.DeleteCommand != null)
					_dbadapter.DeleteCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_TIMEKEEPER_SHIFT_Save(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode, Boolean AllDay, Boolean D1, Boolean D2, Boolean D3, Boolean D4, Boolean D5, Boolean D6, Boolean D7, Boolean D8, Boolean D9, Boolean D10, Boolean D11, Boolean D12, Boolean D13, Boolean D14, Boolean D15, Boolean D16, Boolean D17, Boolean D18, Boolean D19, Boolean D20, Boolean D21, Boolean D22, Boolean D23, Boolean D24, Boolean D25, Boolean D26, Boolean D27, Boolean D28, Boolean D29, Boolean D30, Boolean D31)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_TIMEKEEPER_SHIFT_Save");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@AllDay", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D1", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D2", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D3", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D4", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D5", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D6", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D7", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D8", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D9", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D10", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D11", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D12", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D13", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D14", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D15", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D16", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D17", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D18", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D19", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D20", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D21", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D22", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D23", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D24", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D25", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D26", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D27", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D28", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D29", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D30", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@D31", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.UpdateCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.UpdateCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				SqlBoolean AllDaySQL = AllDay;
				_dbadapter.UpdateCommand.Parameters["@AllDay"].Value = AllDaySQL;
				SqlBoolean D1SQL = D1;
				_dbadapter.UpdateCommand.Parameters["@D1"].Value = D1SQL;
				SqlBoolean D2SQL = D2;
				_dbadapter.UpdateCommand.Parameters["@D2"].Value = D2SQL;
				SqlBoolean D3SQL = D3;
				_dbadapter.UpdateCommand.Parameters["@D3"].Value = D3SQL;
				SqlBoolean D4SQL = D4;
				_dbadapter.UpdateCommand.Parameters["@D4"].Value = D4SQL;
				SqlBoolean D5SQL = D5;
				_dbadapter.UpdateCommand.Parameters["@D5"].Value = D5SQL;
				SqlBoolean D6SQL = D6;
				_dbadapter.UpdateCommand.Parameters["@D6"].Value = D6SQL;
				SqlBoolean D7SQL = D7;
				_dbadapter.UpdateCommand.Parameters["@D7"].Value = D7SQL;
				SqlBoolean D8SQL = D8;
				_dbadapter.UpdateCommand.Parameters["@D8"].Value = D8SQL;
				SqlBoolean D9SQL = D9;
				_dbadapter.UpdateCommand.Parameters["@D9"].Value = D9SQL;
				SqlBoolean D10SQL = D10;
				_dbadapter.UpdateCommand.Parameters["@D10"].Value = D10SQL;
				SqlBoolean D11SQL = D11;
				_dbadapter.UpdateCommand.Parameters["@D11"].Value = D11SQL;
				SqlBoolean D12SQL = D12;
				_dbadapter.UpdateCommand.Parameters["@D12"].Value = D12SQL;
				SqlBoolean D13SQL = D13;
				_dbadapter.UpdateCommand.Parameters["@D13"].Value = D13SQL;
				SqlBoolean D14SQL = D14;
				_dbadapter.UpdateCommand.Parameters["@D14"].Value = D14SQL;
				SqlBoolean D15SQL = D15;
				_dbadapter.UpdateCommand.Parameters["@D15"].Value = D15SQL;
				SqlBoolean D16SQL = D16;
				_dbadapter.UpdateCommand.Parameters["@D16"].Value = D16SQL;
				SqlBoolean D17SQL = D17;
				_dbadapter.UpdateCommand.Parameters["@D17"].Value = D17SQL;
				SqlBoolean D18SQL = D18;
				_dbadapter.UpdateCommand.Parameters["@D18"].Value = D18SQL;
				SqlBoolean D19SQL = D19;
				_dbadapter.UpdateCommand.Parameters["@D19"].Value = D19SQL;
				SqlBoolean D20SQL = D20;
				_dbadapter.UpdateCommand.Parameters["@D20"].Value = D20SQL;
				SqlBoolean D21SQL = D21;
				_dbadapter.UpdateCommand.Parameters["@D21"].Value = D21SQL;
				SqlBoolean D22SQL = D22;
				_dbadapter.UpdateCommand.Parameters["@D22"].Value = D22SQL;
				SqlBoolean D23SQL = D23;
				_dbadapter.UpdateCommand.Parameters["@D23"].Value = D23SQL;
				SqlBoolean D24SQL = D24;
				_dbadapter.UpdateCommand.Parameters["@D24"].Value = D24SQL;
				SqlBoolean D25SQL = D25;
				_dbadapter.UpdateCommand.Parameters["@D25"].Value = D25SQL;
				SqlBoolean D26SQL = D26;
				_dbadapter.UpdateCommand.Parameters["@D26"].Value = D26SQL;
				SqlBoolean D27SQL = D27;
				_dbadapter.UpdateCommand.Parameters["@D27"].Value = D27SQL;
				SqlBoolean D28SQL = D28;
				_dbadapter.UpdateCommand.Parameters["@D28"].Value = D28SQL;
				SqlBoolean D29SQL = D29;
				_dbadapter.UpdateCommand.Parameters["@D29"].Value = D29SQL;
				SqlBoolean D30SQL = D30;
				_dbadapter.UpdateCommand.Parameters["@D30"].Value = D30SQL;
				SqlBoolean D31SQL = D31;
				_dbadapter.UpdateCommand.Parameters["@D31"].Value = D31SQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_TIMEKEEPER_SHIFT_Save: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_TIMEKEEPER_SHIFT_Save: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public DataSet HRM_TIMEKEEPER_SHIFT_GetList()
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_TIMEKEEPER_SHIFT_GetList");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Prepare();
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_TIMEKEEPER_SHIFT_GetList: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
		public DataSet HRM_TIMEKEEPER_SHIFT_Get(Guid TimeKeeperTableListID, String EmployeeCode, String ShiftCode)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_TIMEKEEPER_SHIFT_Get");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@TimeKeeperTableListID", SqlDbType.UniqueIdentifier));
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@ShiftCode", SqlDbType.VarChar, 20));
				_dbadapter.SelectCommand.Prepare();
				SqlGuid TimeKeeperTableListIDSQL = TimeKeeperTableListID;
				_dbadapter.SelectCommand.Parameters["@TimeKeeperTableListID"].Value = TimeKeeperTableListIDSQL;
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.SelectCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString ShiftCodeSQL = ShiftCode;
				_dbadapter.SelectCommand.Parameters["@ShiftCode"].Value = ShiftCodeSQL;
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_TIMEKEEPER_SHIFT_Get: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
	}
}
